<template>
  <div class="error_container">
    <div class="img_container">
      <img :src="imgSrc" />
    </div>
  </div>
</template>
<script>
import { config } from "../../js/config.js";
import img404 from "@/resources/error/404.gif";
import img500 from "@/resources/error/500.svg";

export default {
  name: "error",
  data() {
    return {
      imgSrc: "",
    };
  },
  methods: {
    skip: function () {
      let token = localStorage.getItem("token");
      if (token == null || token == "") {
        this.$router.push(config.INDEX_PATH).catch(function () {});
      } else {
        this.$router.push("/main").catch(function () {});
      }
    },
  },
  created: function () {
    let code = this.$route.query.code;
    if (code == 404) {
      this.imgSrc = img404;
    } else if (code == 500) {
      this.imgSrc = img500;
    } else {
      this.imgSrc = img404;
    }
  },
};
</script>

<style scoped>
.error_container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  flex-direction: column;
}
.img_container {
  width: auto;
  height: auto;
  overflow: hidden;
}
.img_container img {
  width: 360px;
  height: auto;
}
.bt_span {
  font-size: 40px;
  font-weight: 500;
  cursor: pointer;
  color: #409eff;
  padding: 10px 10px 10px 10px;
  margin-top: 20px;
  border-radius: 5px 5px 0px 0px;
}
</style>